1
Foundations of R Objects
AI014 Lesson 2
00:00

At the most fundamental level, R does not operate on individual scalars, but on Atomic Vectors. Every object in R is a collection of elements of the same type, defined by their internal storage mode.

1. The Atomic Vector

Even a single value like z <- 100 is a vector of length one. R handles sequences of data—logical, integer, double, complex, character, and raw—as the primary unit of operation.

2. Assignment and Construction

We use the assignment operator <- to bind names to memory. Multi-element vectors are constructed using the c() (combine) function or the : (sequence) operator, such as z <- 0:9.

The Six Atomic Building BlocksLogicalIntegerDoubleComplexCharacterRaw

3. Internal Storage

The function typeof() reveals the low-level C-style representation of an object. For example, R distinguishes between numeric (floating point) and character (strings wrapped in ""). Atomic vectors ensure homogeneity: every element must be of the same type.

$$\text{typeof}(0:9) \rightarrow \text{"integer"}$$

main.py
TERMINAL bash — 80x24
> Ready. Click "Run" to execute.
>